<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Document</title>
	</head>
	<body>
		<p id="txt"></p>
	</body>
	<script>
		setInterval(function(){
			var date=new Date();
			var nian=date.getFullYear();
			var yue=date.getMonth()+1;
			var ri=date.getDate();
			var tian=date.getDay();
			var shi=date.getHours();
			var fen=date.getMinutes();
			var miao=date.getSeconds();
			switch(tian){
				case 0:
					tian='天';
					break;
				case 1:
					tian='一';
					break;
				case 2:
					tian='二';
					break;
				case 3:
					tian='三';
					break;
				case 4:
					tian='四';
					break;
				case 5:
					tian='五';
					break;
				case 6:
					tian='六';
					break;
			}
			var sj='当前时间是：'+nian+'年'+yue+'月'+ri+'日'+' 星期'+tian+' '+xs(shi)+':'+lws(fen)+':'+lws(miao);
			document.getElementById('txt').innerText=sj;
		},1000)
		function lws(num){
			return num<10?'0'+num:num+'';
		}
		function xs(num1){
			if(num1<6){
				return '凌晨'+num1;
			}else if(num1<=12){
				return '上午'+num1;
			}else if(num1<=23){
				return '晚上'+(num-12);
			}else{
				'午夜'+(num1-12);
			}
		}
	</script>
</html>